package com.yanmaohu.nikita.scanner;

/**
 * @author Bright Lee
 */
public final class Token {

    private final TokenType type;
    private final int beginIndex;
    private final int endIndex;
    private final String content;

    public Token(TokenType type, int beginIndex, int endIndex, String content) {
        this.type = type;
        this.beginIndex = beginIndex;
        this.endIndex = endIndex;
        this.content = content;
    }

    public TokenType getType() {
        return type;
    }

    public int getBeginIndex() {
        return beginIndex;
    }

    public int getEndIndex() {
        return endIndex;
    }

    public String getContent() {
        return content;
    }

    public boolean isEof() {
        return type == TokenType.EOF;
    }

    public boolean isId() {
        return type == TokenType.ID;
    }

    public boolean isCharacterLiteral() {
        return type == TokenType.CHARACTER_LITERAL;
    }

    public boolean isIntegerLiteral() {
        return type == TokenType.INTEGER_LITERAL;
    }

    public boolean isStringLiteral() {
        return type == TokenType.STRING_LITERAL;
    }

    public boolean isUse() {
        return type == TokenType.USE;
    }

    public boolean isTrue() {
        return type == TokenType.TRUE;
    }

    public boolean isFalse() {
        return type == TokenType.FALSE;
    }

    public boolean isElse() {
        return type == TokenType.ELSE;
    }

    public boolean isCase() {
        return type == TokenType.CASE;
    }

    public boolean isWhen() {
        return type == TokenType.WHEN;
    }

    public boolean isContinue() {
        return type == TokenType.CONTINUE;
    }

    public boolean isBreak() {
        return type == TokenType.BREAK;
    }

    public boolean isReturn() {
        return type == TokenType.RETURN;
    }

    public boolean isFor() {
        return type == TokenType.FOR;
    }

    public boolean isDo() {
        return type == TokenType.DO;
    }

    public boolean isWhile() {
        return type == TokenType.WHILE;
    }

    public boolean isPublic() {
        return type == TokenType.PUBLIC;
    }

    public boolean isProtected() {
        return type == TokenType.PROTECTED;
    }

    public boolean isGoto() {
        return type == TokenType.GOTO;
    }

    public boolean isMutable() {
        return type == TokenType.MUTABLE;
    }

    public boolean isNative() {
        return type == TokenType.NATIVE;
    }

    public boolean isPlus() {
        return type == TokenType.PLUS;
    }

    public boolean isAddAssign() {
        return type == TokenType.ADD_ASSIGN;
    }

    public boolean isIncAssign() {
        return type == TokenType.INC_ASSIGN;
    }

    public boolean isMinus() {
        return type == TokenType.MINUS;
    }

    public boolean isSubAssign() {
        return type == TokenType.SUB_ASSIGN;
    }

    public boolean isDecAssign() {
        return type == TokenType.DEC_ASSIGN;
    }

    public boolean isMul() {
        return type == TokenType.MUL;
    }

    public boolean isMulAssign() {
        return type == TokenType.MUL_ASSIGN;
    }

    public boolean isDiv() {
        return type == TokenType.DIV;
    }

    public boolean isDivAssign() {
        return type == TokenType.DIV_ASSIGN;
    }

    public boolean isRem() {
        return type == TokenType.REM;
    }

    public boolean isRemAssign() {
        return type == TokenType.REM_ASSIGN;
    }

    public boolean isExp() {
        return type == TokenType.EXP;
    }

    public boolean isExpAssign() {
        return type == TokenType.EXP_ASSIGN;
    }

    public boolean isAssign() {
        return type == TokenType.ASSIGN;
    }

    public boolean isEq() {
        return type == TokenType.EQ;
    }

    public boolean isBitAnd() {
        return type == TokenType.BIT_AND;
    }

    public boolean isBitAndAssign() {
        return type == TokenType.BIT_AND_ASSIGN;
    }

    public boolean isAnd() {
        return type == TokenType.AND;
    }

    public boolean isAndAssign() {
        return type == TokenType.AND_ASSIGN;
    }

    public boolean isBitOr() {
        return type == TokenType.BIT_OR;
    }

    public boolean isBitOrAssign() {
        return type == TokenType.BIT_OR_ASSIGN;
    }

    public boolean isOr() {
        return type == TokenType.OR;
    }

    public boolean isOrAssign() {
        return type == TokenType.OR_ASSIGN;
    }

    public boolean isNot() {
        return type == TokenType.NOT;
    }

    public boolean isNe() {
        return type == TokenType.NE;
    }

    public boolean isGt() {
        return type == TokenType.GT;
    }

    public boolean isGe() {
        return type == TokenType.GE;
    }

    public boolean isRightShift() {
        return type == TokenType.RIGHT_SHIFT;
    }

    public boolean isAmRightShift() {
        return type == TokenType.AM_RIGHT_SHIFT;
    }

    public boolean isLt() {
        return type == TokenType.LT;
    }

    public boolean isLe() {
        return type == TokenType.LE;
    }

    public boolean isLeftShift() {
        return type == TokenType.LEFT_SHIFT;
    }

    public boolean isLeftPar() {
        return type == TokenType.LEFT_PAR;
    }

    public boolean isRightPar() {
        return type == TokenType.RIGHT_PAR;
    }

    public boolean isLeftBrk() {
        return type == TokenType.LEFT_BRK;
    }

    public boolean isRightBrk() {
        return type == TokenType.RIGHT_BRK;
    }

    public boolean isLeftBrc() {
        return type == TokenType.LEFT_BRC;
    }

    public boolean isRightBrc() {
        return type == TokenType.RIGHT_BRC;
    }

    public boolean isComma() {
        return type == TokenType.COMMA;
    }

    public boolean isPeriod() {
        return type == TokenType.PERIOD;
    }

    public boolean isQuest() {
        return type == TokenType.QUEST;
    }

    public boolean isColon() {
        return type == TokenType.COLON;
    }

    public boolean isSemicolon() {
        return type == TokenType.SEMICOLON;
    }

    public boolean isBitInvert() {
        return type == TokenType.BIT_INVERT;
    }

    public boolean isTypeLimit() {
        return type == TokenType.TYPE_LIMIT;
    }

    public boolean isForceTypeConvert() {
        return type == TokenType.FORCE_TYPE_CONVERT;
    }

}
